<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="ZeroClipboard.js"></script>
    <script language="JavaScript">
        // ZeroClipboard.setMoviePath( 'ZeroClipboard.swf' );  //和html不在同一目录需设置setMoviePath
        // ZeroClipboard.setMoviePath( 'ZeroClipboard10.swf' );
        var clip = new ZeroClipboard.Client();   //创建新的Zero Clipboard对象
        clip.setText( '' ); // will be set later on mouseDown   //清空剪贴板
        clip.setHandCursor( true );      //设置鼠标移到复制框时的形状
        clip.setCSSEffects( true );          //启用css
        clip.addEventListener( 'complete', function(client, text) {     //复制完成后的监听事件
            alert("aa")
            clip.hide();                                          // 复制一次后，hide()使复制按钮失效，防止重复计算使用次数
        } );
        clip.addEventListener( 'mouseDown', function(client) {
            clip.setText( document.getElementById('copy_txt').value );
        } );
        clip.glue( 'copy_btn' );
    </script>
</head>
<body>
<input type="text" value="text" id="copy_txt"/><a href="javascirpt:;" id="copy_btn">复制</a>

</body>
</html>